//
//  ProductEntity.m
//  Rong360
//
//  Created by tianliwei on 15/3/14.
//  Copyright (c) 2014 tianliwei. All rights reserved.
//

#import "ProductEntity.h"
static ProductEntity *productEntity;
@implementation ProductEntity

+ (ProductEntity *)sharedProduct{
    @synchronized(self){
        
        if (productEntity == nil) {
            
            productEntity = [[ProductEntity alloc] init];
            productEntity.xyds = [NSArray array];
            productEntity.xyks = [NSArray array];
            productEntity.banks = [NSArray array];
        }
    }
    return productEntity;
}

- (void)parseFromDic:(NSDictionary *)dic{
    NSDictionary *fangdaiDic = [dic objectForKey:@"fangdai"];
    productEntity.p_num = [fangdaiDic objectForKey:@"p_num"];
    productEntity.banks = [fangdaiDic objectForKey:@"p_list"];
//    NSString *rate = [fangdaiDic objectForKey:@"minRateValue"];
//    productEntity.minRateValue = [NSString stringWithFormat:@"%f", [rate floatValue] * 100];
    productEntity.minRateValue = [fangdaiDic objectForKey:@"minRateValue"];
    productEntity.minRateNum = [fangdaiDic objectForKey:@"minRateNum"];
    productEntity.morebankUrl = [fangdaiDic objectForKey:@"more_url"];
    NSDictionary *xinyongdai = [dic objectForKey:@"xinyongdai"];
    productEntity.xyds = [xinyongdai objectForKey:@"p_list"];
    productEntity.moreXYDUrl = [xinyongdai objectForKey:@"more_url"];
    
    NSDictionary *credit = [dic objectForKey:@"credit"];
    productEntity.xyks = [credit objectForKey:@"p_list"];
    productEntity.moreXYKUrl = [credit objectForKey:@"more_url"];
}
@end
